home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Directorty Opus 5 - Magellan 2
/
Opus 5 - Magellan 2.iso
/
Extras
/
CDDAOpus
/
ListCDDA.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-04-02
|
6KB
|
226 lines
/*rx
*
* ListCDDA.rexx - List and display an CDDA disk in a DOpus window
*
* Based on ListLHA.rexx by Geoff Seeley
*
* $VER: ListCDDA 40.1 (26/12/94) by Laurie Lee
*
* Usage: ARexx command ListCDDA.rexx (from DOpus)
*
*/
/*---------------NO USER SERVICABLE PARTS BELOW :-)----------------------------*/
/* misc. variables */
DOpusPort = 'DOPUS.1'
HandlerPort = 'CDDALIST.1'
userdata = ' 0' /* default */
fgpen = ' 1' /* palette 1 */
bgpen = ' 0' /* palette 2 */
selectable = ' 1' /* can select */
unselectable = ' 0' /* can't select */
show = ' 0' /* update win */
before = ' -1' /* add to end */
if ~show(l,"rexxsupport.library") then
call addlib("rexxsupport.library",0,-30,0)
/* make sure we've got somebody to talk to... */
if showlist('Ports', DOpusPort) = 0 then do
say 'Directory Opus Arexx port not found. Aborting.'
call CleanUp
end
else do
/* make sure DOpus is listening to us... */
address 'DOPUS.1'
options results
/* get some information from DOpus */
Status 3
CurrentWindow = Result
Status 14 CurrentWindow
CDDAFileName = Result
end
/* setup DOpus window and tell user what's happening */
ClearWin CurrentWindow
Busy on
TopText "Getting List of Tracks(s) From CD. Please Wait..."
/* parse the list of CDDA files */
TopText "Parsing File(s). Please Wait..."
call ParseCDDAList
'DisplayDir -1'
/* if handler is running, attach a custom handler to the window */
if show('p', HandlerPort) then
'AddCustHandler '||HandlerPort||' -1'
/* That's all folks... */
TopText "OK"
Busy off
call CleanUp
exit
/*---------------------------------------------------------------------------*/
ParseCDDAList: /* open the listing file, and parse it */
address YACDP
'GETVAR MAXTRACK'
res=RC
select
when res = 0 then do
address YACDP
'GETVAR CDNAME'
'GETVAR BY'
address DOPUS.1
TitleEntry = "'CD Title'" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
TitleEntry = "" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
TitleEntry = Quote(' '||CDNAME) || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
SetWinTitle Quote(CDNAME)
TitleEntry = "' By'" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
TitleEntry = Quote(' '||BY) || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
TitleEntry = "" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
TitleEntry = "" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
TitleEntry = "'Track Name Length'" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
TitleEntry = "" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
do i=1 to MAXTRACK
address YACDP
'GETVAR SONGNAME NUM='i
'GETVAR TRACKLEN NUM='i
mytime=TRACKLEN/75
minute=mytime%60
seconds=mytime//60
if POS('.',seconds) > 0 then do
seconds=left(seconds,POS('.',seconds)-1)
end
mytime = minute || 'm' || ' ' || seconds || 's'
NEWSONGNAME=OVERLAY(SONGNAME,' ',1,20)
address DOPUS.1
SELECT
when i<=9 then do
newname = Quote(i || ' ' || NEWSONGNAME || ' (' || mytime || ')')
end
when i>9 & i <100 then do
newname = Quote(i || ' ' || NEWSONGNAME || ' (' || mytime || ')')
end
otherwise do
newname = Quote(i || ' ' || NEWSONGNAME || ' (' || mytime || ')')
end
end
TitleEntry = newname || userdata || fgpen || bgpen || selectable || show || before
AddCustEntry TitleEntry
end
address DOPUS.1
TitleEntry = "" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
TitleEntry = "'CD Controls'" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
TitleEntry = "" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
TitleEntry = "Eject" || userdata || fgpen || bgpen || selectable || show || before
AddCustEntry TitleEntry
TitleEntry = "Stop" || userdata || fgpen || bgpen || selectable || show || before
AddCustEntry TitleEntry
TitleEntry = "Next" || userdata || fgpen || bgpen || selectable || show || before
AddCustEntry TitleEntry
TitleEntry = "Previous" || userdata || fgpen || bgpen || selectable || show || before
AddCustEntry TitleEntry
end
when res = 10 then do
'GETVAR STATUS'
select
when STATUS =1 then do
address DOPUS.1
TitleEntry = "'No CD inserted'" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
end
when STATUS=2 then do
address DOPUS.1
TitleEntry = "'Data Only CD inserted'" || userdata || fgpen || bgpen || unselectable || show || before
AddCustEntry TitleEntry
end
otherwise do
nop
end
end
end
otherwise do
nop
end
end
return
Quote: procedure /* add quotes to string */
parse arg string
return '"'||string||'"'
CleanUp: /* Remove any files and exit */
Busy off
exit
return